<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改宠物')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-pets-edit" th:object="${pets}">
            <h4 class="form-header h4">宠物信息</h4>
            <input name="petId" th:field="*{petId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">客户名：</label>
                    <div class="col-sm-8">
                        <input name="clientId" th:field="*{clientName}" class="form-control" type="text" required disabled>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">宠物名：</label>
                    <div class="col-sm-8">
                        <input name="name" th:field="*{name}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>

            <!--选择上传宠物照片-->
<!--            <div class="col-xs-12">-->
<!--                <div class="form-group">-->
<!--                    <label class="col-sm-3 control-label">宠物图片：</label>-->
<!--                    <div class="col-sm-8">-->
<!--                        <div class="avatar-edit">-->
<!--                            <input type="file" id="petImageUpload"-->
<!--                                   accept=".png,.jpg,.jpeg"-->
<!--                                   th:attr="data-url=@{/system/pet/uploadImage}" />-->
<!--                            <label for="petImageUpload"></label>-->
<!--                        </div>-->
<!--                        <div class="avatar-preview">-->
<!--                            <div id="petImagePreview"-->
<!--                                 th:style="'background-image: url(' +-->
<!--                     (${petInfo.petImage} ? ${petInfo.petImage} : '/static/img/default-pet.png') + ');'">-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">种类：</label>
                    <div class="col-sm-8">
                        <select name="type" class="form-control m-b" th:with="type=${@dict.getType('sys_pet_type')}" required>
                            <option value="">-- 请选择 --</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{type}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">出生日期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="birthday" th:value="${#dates.format(pets.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">健康状况：</label>
                    <div class="col-sm-8">
<!--                        <input name="name" th:field="*{healthStatus}" class="form-control" type="text" required>-->
                        <select class="form-control" th:field="*{healthStatus}">
                            <option value="0">健康</option>
                            <option value="1">生病</option>
                        </select>
                    </div>

                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/pets";
        $("#form-pets-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                // console.log($('#form-pets-edit').serialize())
                $.operate.save(prefix + "/edit", $('#form-pets-edit').serialize());
            }
        }

        $("input[name='birthday']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>